﻿using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;
using SmartPlant.Core;
using SmartPlant.Modules.Base.ViewModels;
using SmartPlant.Modules.Base.Views;
using SmartPlant.WinCore.Helper;

namespace SmartPlant.Modules.Base
{
    public class BaseModule : IModule
    {
        private readonly IRegionManager _regionManager;

        public BaseModule(IRegionManager regionManager)
        {
            _regionManager = regionManager;
        }
        /// <summary>
        /// 这里就直接加载在mainWindows里的，docking里的2个树和主区域了。
        /// </summary>
        /// <param name="containerProvider"></param>
        public void OnInitialized(IContainerProvider containerProvider)
        {
            _regionManager.RequestNavigate(RegionNames.ContentRegion, "Welcome");
            _regionManager.RequestNavigate(RegionNames.ContentRegion, "DomainExplorer");
            _regionManager.RequestNavigate(RegionNames.ContentRegion, "PlantTree");
        }

        /// <summary>
        /// 注册导航的view
        /// </summary>
        /// <param name="containerRegistry"></param>
        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            LoggerHelper.Current.Info($"注册系统导航服务。");
            containerRegistry.RegisterForNavigation<SpecOutput>();
            containerRegistry.RegisterForNavigation<SpecInput>();
            containerRegistry.RegisterForNavigation<IndexTableImport>();
            containerRegistry.RegisterForNavigation<IndexTableOutput>();


            containerRegistry.RegisterForNavigation<SpecEdit>();
            containerRegistry.RegisterForNavigation<PdGeneralEdit>();
            containerRegistry.RegisterForNavigation<PdLevelEdit>();

            containerRegistry.RegisterForNavigation<PlantTree>();
            containerRegistry.RegisterForNavigation<DomainExplorer>();
            //containerRegistry.RegisterForNavigation<OutputSetting>();
            containerRegistry.RegisterForNavigation<RevisionManager>();
            containerRegistry.RegisterForNavigation<IndexTable>();
            containerRegistry.RegisterForNavigation<IndexTablePD>();
            containerRegistry.RegisterForNavigation<DrawingDoc,DrawingDocViewModel>(); 

            //containerRegistry.RegisterForNavigation<IndexTableSetting>();

            containerRegistry.RegisterForNavigation<ItemListBom>();
            //containerRegistry.RegisterForNavigation<ItemListSetting>();
            containerRegistry.RegisterForNavigation<ItemDwg>();

            containerRegistry.RegisterForNavigation<ProjectReport>();

            containerRegistry.RegisterForNavigation<HookUp>();

            containerRegistry.RegisterForNavigation<Welcome>();

            containerRegistry.RegisterForNavigation<TemplateSetting>();

            containerRegistry.RegisterForNavigation<UserManage>();
            containerRegistry.RegisterForNavigation<UserGroupManage>();


            containerRegistry.RegisterForNavigation<TaskJob>();

            containerRegistry.RegisterDialog<CommonProperty>();
            containerRegistry.RegisterDialog<SpecGeneralDataTemplate>();
        }
    }
}